package com.yunji.cabinet.enums;


/**
 * @version 1.0
 * @Project: yunji-coffee
 * @Package com.yunji.netty.enums
 * @FileName MessageEnum.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * Company		com
 * @CreateTime 2024-07-29 14:46:08
 * @Description 消息处理枚举
 * @Modification Author                    History Time			Version				Description
 * --------------------------------------------------------------------------------
 * HuaAo0803@163.com	2024-03-25 14:46:08		1.0					1.0 Version
 * @since JDK 1.8.0_202
 */
public enum MessageEnum {

    ERROR_00100010001("00100010001", "验签失败!"),
    ERROR_00200010001("00200010001", "数据:[{}]解析失败!"),
    ERROR_00200010002("00200010002", "未知业务信息!"),
    ERROR_00300010001("00300010001", "芯片代码错误!"),
    ERROR_00300010002("00300010002", "货柜已离线!"),
    ERROR_02400010001("02400010001", "货柜操作数据错误!"),
    ERROR_02400010002("02400010002", "货柜操作数据解析失败!");


    private final String code;
    private final String info;

    MessageEnum(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public static MessageEnum getEnum(String code) {
        if (null == code || code.isEmpty()) {
            return null;
        }

        for (MessageEnum e : MessageEnum.values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }
}
